package com.win.autowired.service.impl;

import com.win.autowired.dao.UserDao;
import com.win.autowired.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

//    1.属性注入
    @Autowired
    @Qualifier(value = "userDaoRedisImpl")
    private UserDao userDao;


//    2.set注入
//    private UserDao userDao;
//    @Autowired
//    public void setUserDao(UserDao userDao) {
//        this.userDao = userDao;
//    }

//    3.构造方法注入
//    private UserDao userDao;
//    @Autowired
//    public UserServiceImpl(UserDao userDao) {
//        this.userDao = userDao;
//    }

//    4. 形参注入
//    private UserDao userDao;
//    public UserServiceImpl(@Autowired UserDao userDao) {
//        this.userDao = userDao;
//    }
    @Override
    public void add() {
        userDao.add();
        System.out.println("Service层执行结束");
    }
}
